import { Injectable } from '@angular/core';
import {RequestUtil} from '../../../util/request-util';
import {MsgResult} from '../../../models/msg-result';
import {Observable} from 'rxjs/Rx';
import {FormUtil} from '../../../util/form-util';
import {API} from '../../../constants/constants';
import {DaAPI} from '../da-constants';

@Injectable()
export class DaCabinetTemphumService {

  constructor(
    private requestUtil: RequestUtil,
    private formUtil: FormUtil
  ) {}
  /**
   * 获取站点数据
   * @returns {Observable<MsgResult>}
   */
  getSiteData(): Observable<MsgResult> {
    const params = 'siteTypeCode=400' + '&monitorCode=' + "'AIR'";
    return this.requestUtil.get(DaAPI.getSiteData, params);
  }
  /**
   * 获取表格数据
   * @returns {Observable<MsgResult>}
   */
  getTableHeadData(data): Observable<MsgResult> {
    const params = this.formUtil.serialize(data);
    return this.requestUtil.get(DaAPI.airCab, params);
  }
  /**
   * 获取站点数据
   * data
   * @returns {Observable<MsgResult>}
   */
  getExcel(data): Observable<MsgResult> {
    const params = this.formUtil.serialize(data);
    return this.requestUtil.getFile('', params);
  }
}
